const express = require("express");
const Captcha = require("../utils/captcha/index");
router = express.Router();  // 页面路由


// 获取验证码图片
router.get("/validateImage/:random", (req, res) => {
    
    let captchaObj = new Captcha();
    let captcha = captchaObj.getCode();
    
    //注意：返回给浏览器的时候，需要设置响应头
    res.setHeader('Content-Type', 'image/svg+xml');
    res.send(captcha.data);
});

module.exports = router;